<app-progress-line *ngIf="isRequesting"></app-progress-line>
<form>
  <app-error-message *ngIf="response && response.error">
    {{response.error.message}}
  </app-error-message>

  <app-device-general-information [response]="response" [mode]="form.id ? 'edit': 'new'" [device]="form" 
    (onChange)="DeviceGeneralChange($event)" ></app-device-general-information>

    <app-device-temperature
      *ngIf="IsTemperature()"
      [preferences]="form.preferences" 
      (onChange)="DeviceCustomizationChange($event)">
    </app-device-temperature>
    <app-device-lamp
      *ngIf="IsLamp()"
      [preferences]="form.preferences" 
      (onChange)="DeviceCustomizationChange($event)">
    </app-device-lamp>
    
    <app-device-humidity
      *ngIf="IsHumidity()"
      [preferences]="form.preferences" 
      (onChange)="DeviceCustomizationChange($event)">
    </app-device-humidity>


    <app-device-co2
      *ngIf="IsCo2()"
      [preferences]="form.preferences" 
      (onChange)="DeviceCustomizationChange($event)">
    </app-device-co2>

  <button (click)="SubmitForm()" translate class="btn btn-primary app-device-single-edit" *ngIf="form.id">Edit device</button>
  <button (click)="DeleteDevice()" translate class="btn btn-danger" *ngIf="form.id">Delete device</button>
  <button (click)="SubmitForm()" class="btn btn-primary app-device-single-create" *ngIf="!form.id" translate>Create device</button>
  <a class="btn btn-warning app-device-single-cancel" routerLink="/devices" translate>cancel</a>

</form>
